package net.itgoo.parkingpay.ui.payconfirm;

import android.os.Bundle;

import net.itgoo.parkingpay.R;
import net.itgoo.parkingpay.vendor.mvp.ParkingMVPUtils;
import net.itgoo.parkingpay.vendor.widget.activity.ParkingBaseActivity;

import java.util.HashMap;
import java.util.Map;

public class ParkingPayConfirmActivity extends ParkingBaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.parking_activity_pay_confirm);
        initUI();
    }

    private void initUI() {
        initChildFragment();
    }

    private void initChildFragment() {
        ParkingPayConfirmFragment fragment =
                (ParkingPayConfirmFragment) getSupportFragmentManager().findFragmentById(R.id.parking_activity_pay_confirm_content_fl);

        if (fragment == null) {
            fragment = ParkingPayConfirmFragment.newInstance(getIntent().getExtras());
            ParkingMVPUtils.addFragmentToActivity(getSupportFragmentManager(),
                    fragment, R.id.parking_activity_pay_confirm_content_fl);
        }

        Map<String, String> map = new HashMap<>();
        map.put("id", String.valueOf(getIntent().getLongExtra("id", 0)));
        new ParkingPayConfirmPresenter(map, fragment, new ParkingPayConfirmDataRepository());
    }
}
